package cn.itcast.order.ui;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import cn.itcast.order.R;

public class ShowActivity extends AppCompatActivity {

    TextView tv_info;

    ImageView imageView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show);
        init();
    }

    //初始化操作
    private void init(){
        //拿到上一个Activity传递过来的数据
        Intent intent = getIntent();
        String info = intent.getStringExtra("info");
        int image = intent.getIntExtra("image",0);
        //绑定控件
        imageView = findViewById(R.id.image);
        tv_info = findViewById(R.id.info);
        //将数据发送到TextView和ImageView
        tv_info.setText(info);
        imageView.setImageResource(image);
    }
}